package org.example.spring_blog.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.example.spring_blog.util.DateUntils;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class BlogInfo {
    private Integer id;
    @NotBlank(message = "标题不能为空")
    private String title;
    @NotBlank(message = "文章内容不能为空")
    private String content;
    private Integer userId;
    private Integer deleteFlag;
    private Boolean isLoginUser;
    private Date createTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

//    public String getDate() {
//        return DateUntils.format(updateTime);
//    }
}
